import unittest
from api.login_iHRM_api import LoginApi
from common.assert_util import api_assert


class TestLogin(unittest.TestCase):
#登陆成功
    def test01_case001(self):
        response =LoginApi.login_iHRM({"mobile": "13800000002", "password": "123456"})
        print(response.json())
        api_assert(self,response,200,"操作成功",True)

   #不输入手机号
    def test01_case002(self):
        response =LoginApi.login_iHRM({"mobile": "", "password": "123456"})
        print(response.json())
        api_assert(self, response, 200, "用户名或密码错误", False)

     #不输入密码
    def test01_case003(self):
        response =LoginApi.login_iHRM({"mobile": "13800000002", "password": ""})
        print(response.json())
        api_assert(self, response, 200, "用户名或密码错误", False)

      #手机号长度小于11位
    def test01_case004(self):
        response =LoginApi.login_iHRM({"mobile": "1380000000", "password": "123456"})
        print(response.json())
        api_assert(self, response, 200, "用户名或密码错误", False)

#手机号长度大于11位
    def test01_case005(self):
        response =LoginApi.login_iHRM({"mobile": "138000000023", "password": "123456"})
        print(response.json())
        api_assert(self, response, 200, "用户名或密码错误", False)

#手机号输入非数字
    def test01_case006(self):
        response =LoginApi.login_iHRM({"mobile": "erro", "password": "123456"})
        print(response.json())
        api_assert(self, response, 200, "用户名或密码错误", False)

#输入未注册的手机号
    def test01_case007(self):
        response =LoginApi.login_iHRM({"mobile": "13802340002", "password": "123456"})
        print(response.json())
        api_assert(self, response, 200, "用户名或密码错误", False)


